# -*- coding: UTF-8 -*-

import requests
import time

#import sys
#reload(sys)
#sys.setdefaultencoding('utf-8')
pt = "C:\\hongzhangzhao\\projects\\oss\\sts\\mytest\\bingfeng.bmp"
starttime = time.time()
s = starttime
sum = 0
print('start time: ', s)
for x in range(0,1):
    xxx = str(x)
    
    data = {
        "username": "hongz"
    }
    
    files = {
        "img": open(pt,"rb"),
    }
    #print('send data: %s' % str(data))
    try:

        res = requests.post("http://39.106.248.147:8000/uploadFile/",data=data,files=files)
        #print(x,res)
        print(res.text)

    except Exception as e:
        print(e,"----------")
    e = time.time()

    print(xxx ," take one file time: %s" % (e - s))
    sss = e - s
    sum += sss
    print('bu wan quan zong shi jian: ', sum)
    s = e
    
endtime = time.time()
print("take time: %s" % (endtime - starttime))